java.lang.ClassCastException: can't cast `java/util/jar/JarF

User 7705ec00ca

19-11-2007 13:36:33

I have installed jchem-3_2_11-linux and marvinbeans-4_1_13. There was no error during installation. However when I try to start mview or msketch I get the following error message and mview and msketch are no starting up:





java.lang.ClassCastException: can't cast `java/util/jar/JarFile$EntryInputStream' to `java/awt/image/ImageProducer'


at chemaxon.marvin.View.<init> (View.java:265)


at chemaxon.marvin.View.main (View.java:1165)





Any help would be highly appreciated.





Thanks!





Shaheen

ChemAxon 7c2d26e5cf

19-11-2007 13:56:27

Probably, you use a non-Sun distributed Java version.


Marvin supports only Sun distributed Java. Please check which Java version is used by Marvin.





To check Java location:


Code:
which java



To check version number and vendor:


Code:
java -version



Please see the following links, they may be useful.


http://www.chemaxon.com/marvin/doc/user/installguide.html#linux


http://www.chemaxon.com/forum/ftopic2198.html&highlight=linux+java


http://www.chemaxon.com/forum/ftopic2263.html&highlight=linux+java

User 7705ec00ca

19-11-2007 16:25:06

A Sun-distributed Java version is installed





java -version gives the following output:





java version "1.6.0_01"


Java(TM) SE Runtime Environment (build 1.6.0_01-b06)


Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)





By the way, I have Debian Linux (Kernelversion 2.6) as OS on an AMD 32bit processor.





Thanks!





Shaheen

ChemAxon 7c2d26e5cf

19-11-2007 17:10:28

I have checked the code.


By this line, MarvinView try to load the mview icon file from the jar.


Firstly, please check that chemaxon/marvin/beans/mview16.gif is in MarvinBeans.jar.


Code:
unzip -l marvinbeanslib/MarvinBeans.jar|grep mview16.gif





      613  09-20-07 17:09   chemaxon/marvin/beans/mview16.gif



If it is missing your jar may be corrupt or damaged. In this case, please install it again.





If the icon file is OK, the problem may be in the CLASSPATH. Probably, both jchem.jar and MarvinBeans.jar are in the CLASSPATH (or an earlier version is also there).


Because of it, Java can not decide from which jar should be loaded the icon file.


In this case, please remove any ChemAxon jars from the CLASSPATH.


Marvin/JChem bundled scripts load the proper jar(s) for running the applications, assiging jars to the CLASSPATH is needless.


Hopefully, cleaning CLASSPATH solves the problem and helps to avoid any further class loading problem.


By the way, jchem.jar includes the whole Marvin Beans API. With other word, JChem includes also all resources to run Marvin applications.





Actually, installing JChem bundled Marvin is needless under Linux.


The Windows or Mac installer of Marvin Beans contains extra features (e.g.: desktop icon or file association for Marvin applications) that are missing from JChem why installing Marvin separately can be recommended on those platform.

User 7705ec00ca

20-11-2007 11:48:23

chemaxon/marvin/beans/mview16.gif is in MarvinBeans.jar.





I have added MarvinBeans.jar to the CLASSPATH (jchem.jar is not in the CLASSPATH), as when I first got the mentioned error message MarvinBeans.jar was not in the CLASSPATH, however, the same error message appears and mview does not start up. By the way, when I try to start msketch I get a the following analogous message:





java.lang.ClassCastException: can't cast `java/util/jar/JarFile$EntryInputStream' to `java/awt/image/ImageProducer'


at chemaxon.marvin.Sketch.<init> (source file unknown:line unknown, pc 0x91f3e97)


at chemaxon.marvin.Sketch.main (source file unknown:line unknown, pc 0x90bcbe1)





Many thanks for your help!





Shaheen

ChemAxon 7c2d26e5cf

21-11-2007 20:12:15

Please type the following statement in a terminal/shell window:


Code:
java -classpath "<MARVINBEANSHOME>/lib/MarvinBeans.jar" chemaxon.marvin.Sketch



where "<MARVINBEANSHOME>" is the location of the "marvinbeans" directory (e.g.: /home/vertset/ChemAxon/MarvinBeans).


Is it work?

User 7705ec00ca

21-11-2007 21:02:29

I have type the following in a terminal window:





java -classpath /usr/local/ChemAxon/MarvinBeans/lib/MarvinBeans.jar chemaxon.marvin.Sketch





However the error message is the same as before, namely:





java.lang.ClassCastException: can't cast `java/util/jar/JarFile$EntryInputStream' to `java/awt/image/ImageProducer'


at chemaxon.marvin.Sketch.<init> (source file unknown:line unknown, pc 0x905ce97)


at chemaxon.marvin.Sketch.main (source file unknown:line unknown, pc 0x9000be1)





Thanks for your help!

ChemAxon 7c2d26e5cf

23-11-2007 10:31:16

It can be some kind of configuration issue. I have managed to launch MarvinSketch with JRE 1.6.0_03 on Ubuntu Linux 7.10. It works fine for me.


Are you sure that the jar file is not damaged? Other applications (like cxcalc or molconverter) work for you?


Or it may be a Java 1.6.0_01 specific issue. Please try to upgrade your Java to a newer version. Probably, it solves the problem.